<template>
  <div class="admin-container">
    <el-container>
      <Menu
        :isCollapse="isCollapse"
        class="left-in"
        :style="{ left: interProject ? '0px' : '-240px' }"
      />
      <el-container class="container" :style="{ left: menuPositionLeft }">
        <el-header
          class="header"
          :class="{ fixed: fixedHead, notag: !tag }"
          height="60px"
          :style="{ left: menuPositionLeft }"
        >
          <NavBar @handleCollapse="handleCollapse" />
          <!-- <template v-if="tag">
              <TabBar />
            </template> -->
        </el-header>
        <el-main class="main">
          <!-- <CustomBreadcrumb /> -->
          <AppMain />
        </el-main>
      </el-container>
    </el-container>
    <el-backtop />
  </div>
</template>

<script setup>
import { computed } from "vue";
import { useStore } from "vuex";
const store = useStore();

const fixedHead = computed(() => {
  return store.getters["setting/fixedHead"];
});

const tag = computed(() => {
  return store.getters["setting/tag"];
});

const isCollapse = computed(() => {
  return store.getters.collapse;
});

const interProject = computed(() => {
  return store.getters["project/interProject"];
});

const handleCollapse = () => {
  store.dispatch("setting/changeCollapse");
};
const menuPositionLeft = computed(() => {
  let left = "0px";
  // 进入项目才展示左侧菜单
  if (interProject.value) {
    left = isCollapse.value ? "65px" : "240px";
  }
  return left;
});
</script>

<style lang="scss" scoped>
.admin-container {
  position: relative;
  background-color: $base-content-bg-color;
  .container {
    position: absolute;
    right: 0;
    transition: all $base-transition-time-4;
  }
  .header {
    padding: 0;
    transition: all $base-transition-time-4;
    &.fixed {
      position: fixed;
      top: 0;
      right: 0;
      z-index: $base-z-index-999;
    }
  }
  .main {
    position: relative;
    top: $base-main-vertical-top;
    overflow-y: auto;
    &.fixed {
      top: $base-main-fixed-top;
    }
    &[class="el-main main fixed notag"] {
      top: $base-main-vertical-fixed-notag-top;
    }
    &[class="el-main main notag"] {
      top: $base-main-notag-top;
    }
    background-color: $base-content-bg-color;
  }
}
</style>
